package com.piggy.system.api;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.common.core.constant.ServiceNameConstants;
import com.piggy.common.core.web.domain.AjaxResult;
import com.piggy.system.api.bo.SysRoleSceneRlQueryBo;
import com.piggy.common.core.domain.R;
import com.piggy.system.api.domain.SysRoleSceneRl;
import com.piggy.system.api.factory.RemoteISysRoleSceneRlFallbackFactory;
import com.piggy.system.api.vo.SysRoleSceneRlVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteISysRoleSceneRlService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteISysRoleSceneRlFallbackFactory.class)
public interface RemoteISysRoleSceneRlService {

    /**
     * 根据场景id获取角色列表
     * @param id
     * @return
     */
    @GetMapping("/roleSceneRl/getSceneRole")
    AjaxResult getSceneRole(@RequestParam("id")Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/roleSceneRl/addOrUpdateRole/{sceneId}")
    AjaxResult addOrUpdateRole(@RequestBody List<SysRoleSceneRl> roleSceneRls, @PathVariable("sceneId") Long sceneId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/roleSceneRl/activation")
    int activation(@RequestParam("sceneId")Long sceneId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/roleSceneRl/queryList")
    R<List<SysRoleSceneRlVo>> queryList(@RequestBody SysRoleSceneRlQueryBo bo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
